﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BLL.Entities;
using BLL;

namespace CorporateGymManagementSystem
{
    /// <summary>
    /// Interaction logic for DisplayMalfunctionWindow.xaml
    /// </summary>
    public partial class DisplayMalfunctionWindow : Window
    {
        public DisplayMalfunctionWindow(Malfunction i_Malfunction)
        {
            InitializeComponent();
            subjectValueLabel.Content = i_Malfunction.Subject.ToString();
            descriptionValueTextBlock.Text = i_Malfunction.Description.ToString();
            GymWorker creator = GymWorkerManager.Instance.GetWorkerById(i_Malfunction.CreatorId);
            createdByValueLabel.Content = creator == null ? "Unknown Worker" : creator.FullName;
            dateCreatedValueLabel.Content = i_Malfunction.CreatedTime.ToString();
            int closerId = i_Malfunction.CloserId;
            if (closerId != -1)
            {
                GymWorker worker = GymWorkerManager.Instance.GetWorkerById(closerId);
                closedByValueLabel.Content = worker.FullName;
                dateClosedValueLabel.Content = i_Malfunction.ClosedTime.ToString();
            }
            else
            {
                closedByValueLabel.Content = "";
                dateClosedValueLabel.Content = "";
            }
        }
    }
}
